﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Windows.Forms;
using SAM_Edu.dao;
using SAM_Edu.entity;
using System.Drawing;


namespace SAM_Edu.control
{
      
    class CreateUser
    {

        
       static Accounts acc;
       static User user;

      

        public static void RequestCreateUserAccount(string firstname, string middlename, string lastname, string othername, string email, int countrycode, int areacode, int mobileno,string username , string password , string securityQn,string securityAns, string rfidno, Image img)
        {
           
            user = new User(firstname, middlename, lastname, othername, email, countrycode, areacode, mobileno,0,img );
          int result =   daoUser.CreateUser(user);
          acc = new Accounts(username, password, securityQn, securityAns, rfidno , result);
          bool result2=  daoAccounts.CreateAccount(acc);
          if ( result2 == true)
          {
              MessageBox.Show("Sucessfully registered account");
          }
          else
          {
              MessageBox.Show("Error creating account");
          }
           
        }
    }
}
